package com.atguigu.c_designed.m3beheviorModel.b8Memento;

import lombok.AllArgsConstructor;
import lombok.Data;

@Data
@AllArgsConstructor
public class OriginatorEditor {
    private String title;
    private String content;
    private String img;

    public MementoArticle saveToMemento(){
        MementoArticle mementoArticle = new MementoArticle(this.title, this.content, this.img);
        return mementoArticle;
    }

    public void undoFromMemento(MementoArticle mementoArticle){
        this.title = mementoArticle.getTitle();
        this.content = mementoArticle.getContent();
        this.img = mementoArticle.getImg();
    }
}
